<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>预约管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" th:href="@{/layuimini/lib/layui-v2.5.5/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/layuimini/css/public.css}" media="all">
    <link rel="stylesheet" th:href="@{/layuimini/js/lay-module/dtree/dtree.css}">
    <link rel="stylesheet" th:href="@{/layuimini/js/lay-module/dtree/font/dtreefont.css}">

</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

        <script type="text/html" id="currentTableBar">
            <a class="layui-btn layui-btn-xs" lay-event="detail">详情</a>
        </script>

    </div>
</div>

<div id="detailFormModal" style="display: none;padding: 10px">
    <form class="layui-form" id="detailForm" lay-filter="detailFormFilter">
        <div class="layui-form-item">
            <label class="layui-form-label">账号名称</label>
            <div class="layui-input-block">
                <input type="text" name="nickname" readonly class="layui-input layui-input-view" style="border: none">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">开始时间</label>
            <div class="layui-input-block">
                <input type="text" name="startTime" readonly class="layui-input layui-input-view" style="border: none">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">结束时间</label>
            <div class="layui-input-block">
                <input type="text" name="endTime" readonly class="layui-input layui-input-view" style="border: none">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">房间名</label>
            <div class="layui-input-block">
                <input type="text" name="roomName" readonly class="layui-input layui-input-view" style="border: none">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">房间号</label>
            <div class="layui-input-block">
                <input type="text" name="roomNumber" readonly class="layui-input layui-input-view" style="border: none">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">房间类型</label>
            <div class="layui-input-block">
                <input name="roomType" readonly class="layui-input layui-input-view" style="border: none"></input>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">价格</label>
            <div class="layui-input-block">
                <input name="roomPrice" readonly class="layui-input layui-input-view" style="border: none"></input>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">电影名称</label>
            <div class="layui-input-block">
                <input name="movieName" readonly class="layui-input layui-input-view" style="border: none"></input>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn layui-btn-primary" id="detailFormReset">关闭</button>
            </div>
        </div>
    </form>
</div>

<!--xml-select 解决layui多选的解决方案(从后端拿数据)-->
<script th:src="@{/layuimini/js/lay-module/xm-select/xm-select.js}"></script>
<script th:src="@{/layuimini/lib/layui-v2.5.5/layui.js}" charset="utf-8"></script>
<script th:src="@{/layuimini/js/lay-config.js?v=2.0.0}" charset="utf-8"></script>
<script>
    layui.use(['form', 'table','dtree'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;

        table.render({
            elem: '#currentTableId',
            method: 'post',
            url: '/system/appointmentInfo/listAll2',
            toolbar: '#toolbar',
            defaultToolbar: ['filter', 'exports', 'print'],
            cols: [ [
                {type: 'numbers',title: '序号'},
                {field: 'nickname',title: '客户'},
                {field: 'movieName', title: '电影名'},
                {field: 'roomName', title: '房间名'},
                {field: 'roomNumber',title: '房间号'},
                {field: 'roomType',title: '房间类型'},
                {field: 'startTime',title: '开始时间'},
                {field: 'endTime',title: '结束时间'},
                {
                    field: 'process', title: '状态', align: 'center', width: 100, templet: function (d) {
                        let sexArr = ['', '未开始', '正在进行中','已完成','已过期'];
                        return sexArr[d.process];
                    }
                },
                {title: '操作', width: 100,align:"center", toolbar: '#currentTableBar', align: "center"}
            ]],
            limits: [10, 15, 20],
            limit: 10,
            page: true,
        });

        /**
         * 详情、编辑、删除
         */
        table.on('tool(currentTableFilter)',function (obj) {
            let data = obj.data;
            if(obj.event === 'detail'){
                let sexArr = ['', '未开始', '正在进行中','已完成','已过期'];
                data.process = sexArr[data.process];
                form.val('detailFormFilter',data);
                layer.open({
                    title: '详细信息',
                    type: 1,
                    content: $('#detailFormModal'),
                    area: ['600px','550px'],
                    maxmin: true
                });
            }
        });

        // 监听 detail表单 关闭
        $('#detailFormReset').on('click', function () {
            $('#detailForm')[0].reset();
            layer.closeAll();
        });


    });
</script>

</body>
</html>